FROM ubuntu:22.04

RUN apt update \
    && apt-get install -y git \
    && apt-get install -y curl \
    && rm -rf /var/lib/apt/lists/*

ENV GO_VERSION=1.20.7 \
    GOOS=linux \
    GOARCH=amd64 \
    GOROOT=/usr/local/go \
    GOPATH=/usr/local/go-packages
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH

# Install Go
# https://go.dev/doc/install
RUN curl -fsSL https://go.dev/dl/go$GO_VERSION.$GOOS-$GOARCH.tar.gz | tar -C /usr/local -xzv
# ADD ./go /usr/local/

RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct

ADD entrypoint.sh /home/entrypoint.sh

RUN chmod +x /home/entrypoint.sh

WORKDIR /home

ENTRYPOINT ["/bin/sh","entrypoint.sh"]